
#ifndef FONT_CACHE_H
#define FONT_CACHE_H

// INCLUDES ********************************************************************

#include "Cache.h"

#include "FTFont.h"

#include "Singleton.h"

#include <string>

// FORWARD DECLARATIONS ********************************************************

// *****************************************************************************

//! FontCache
//! 
//! Caches fonts used in text elements. This is singleton class, the one and 
//! only instance is accessed via MeteorFontCache::Instance().

// *****************************************************************************

namespace Meteor 
{
    class FontCache : public Cache<FTFont*>, public Singleton<FontCache>
    {
        friend class Singleton<FontCache>;
    
        public:
            //! add a font to the cache, returns a newly created freetype font
            FTFont* AddObject( const std::string file);
            
            void AddObjectAsync( const std::string& filename, Function* fileAdded=0);
    
        private:
            FontCache();
            
            ~FontCache();
            
            //! prevent copies
            FontCache( const FontCache&);
            
            const FontCache& operator=( const FontCache&);
    
    }; // end of class FontCache
    
} // end of namespace Meteor

#endif // FONT_CACHE_H
